package com.towerfense;

public class GridSelectionManager {
	GridTile hoverTile;
	GridTile selectedTile;
	
	public GridSelectionManager() {
		hoverTile = null;
		selectedTile = null;
	}
	
	boolean hover(GridTile tile) {
		if(hoverTile != tile) {
			if(hoverTile != null) {
				hoverTile.hover = false;
			}
			hoverTile = tile;
			if(hoverTile != null) {
				hoverTile.hover = true;
			}
			return true;
		}
		return false;
	}
	
	boolean select(GridTile tile) {
		if(selectedTile != tile) {
			if(selectedTile != null) {
				selectedTile.selected = false;
			}
			selectedTile = tile;
			if(selectedTile != null) {
				selectedTile.selected = true;
			}
			return true;
		}
		return false;
	}
}
